var a = getApp();

Page({
    data: {
        obj: {},
        papersCode: [],
        papersArray: [],
        lists: [],
        judge: !0,
        name: [],
        show: !1
    },
    onLoad: function(t) {
        var e = this, s = this.data.papersCode, i = this.data.papersArray, n = wx.getStorageSync("names") || [];
        n.length > 0 && e.setData({
            show: !0,
            name: n.slice(-7)
        }), wx.request({
            url: a.globalData.dicc + "disease/list",
            data: {},
            header: {
                "content-type": "application/json"
            },
            success: function(a) {
                t = a.data.data;
                if (200 == a.data.code) {
                    var t = a.data.data;
                    for (var n in t) s.push(n), i.push(t[n]);
                    e.setData({
                        papersArray: i,
                        papersCode: s
                    });
                }
                e.setData({
                    obj: t
                });
            }
        });
    },
    tabcyclopediadetails: function(a) {
        this.setData({
            show: !0
        });
        var t = null, e = this, s = a.currentTarget.dataset.id, i = a.currentTarget.dataset.text, n = wx.getStorageSync("names") || [], d = {
            id: s,
            text: i
        };
        if (n.length > 0) {
            for (var r = 0; r < n.length; r++) if (n[r].id == s) {
                t = r;
                break;
            }
            null == t && 0 != t || n.splice(t, 1), e.setData({
                name: n.slice(0, 6)
            }), wx.setStorageSync("names", n), wx.setStorageSync("id", s);
        } else n.unshift(d), e.setData({
            name: n.slice(0, 6)
        }), wx.setStorageSync("names", n), wx.setStorageSync("id", s);
        wx.navigateTo({
          url: "/hyb_yl/index/cyclopediadetails/cyclopediadetails"
        });
    },
    tabcyclopediadetails1: function(a) {
        var t = a.currentTarget.dataset.id;
        a.currentTarget.dataset.text;
        wx.setStorageSync("id", t), wx.navigateTo({
          url: "/hyb_yl/index/cyclopediadetails/cyclopediadetails"
        });
    },
    seet: function(t) {
        var e = this;
        wx.request({
            url: a.globalData.dicc + "disease/search",
            data: {
                diseaseName: t.detail.value
            },
            success: function(a) {
                var s = [];
                0 != (s = a.data.data).length && e.setData({
                    lists: s,
                    judge: !0
                }), "" == t.detail.value && e.setData({
                    lists: ""
                });
            }
        });
    },
    none: function(a) {
        this.data.judge;
        this.setData({
            judge: !1
        });
    },
    show: function(a) {
        var t = wx.getStorageSync("names") || [];
        t.length > 0 && that.setData({
            show: !0,
            name: t.slice(-7)
        });
        this.data.judge;
        this.setData({
            judge: !0
        });
    },
    onShow: function(a) {
        this.setData({
            diseaseName: "",
            lists: []
        });
    }
});